// 初始化仓库
// 1. 导入一个方法 生成仓库实例
import {createStore} from 'redux'
import {userInfoReducer} from "./reducers/userInfoReducer";

import {persistStore, persistReducer} from 'redux-persist';
import storage from 'redux-persist/lib/storage';
import autoMergeLevel2 from 'redux-persist/lib/stateReconciler/autoMergeLevel2';
//
//
// let reducers = combineReducers({
//   userInfoReducer
// });

const persistConfig = {
  key: 'root',
  storage: storage,
  stateReconciler: autoMergeLevel2 // 查看 'Merge Process' 部分的具体情况
};

const myPersistReducer = persistReducer(persistConfig, userInfoReducer);

//3:将纯函数 放到 createStore参数中
let store = createStore(myPersistReducer);

window.store = store;

export const persistor = persistStore(store);
export default store;

